package com.wang.common.interceptor;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import com.wang.common.controller.BaseController;

/**
 * 创建一个过滤器的步骤和Servlet一样 实现一个Filter接口
 * 
 * @author wangshMac
 */
@Component
public class CommonInterceptor implements HandlerInterceptor {
	@Autowired
	private BaseController baseController;

	/**
	 * 过滤器所做的事情=====Servlet中的Service
	 * 
	 * @throws IOException
	 */
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws IOException {
		/* 公共请示 */
		this.baseController.commonOper(request);
		return true ; 
	}
}
